import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('@/views/layout'),
    redirect: '/ ',
    children: [
      //路由懒加载会将懒加载的路由单独打包为一个chunk,每次点击的时候才会进行加载
      //如果需要将几个懒加载的功能放到同一个chunk里面,那么在加载的其中一个的时候都会进行加载,切只请求一次
      //将前面统一设置name   /* webpackChunkName: "base" */
      {
        //如果子路由不加dath/ ,自动将父路由path和自己进行拼接,相反不加
        path: '/ ',
        component: () => import(/* webpackChunkName: "base" */ '@/views/home')
      },
      {
        path: '/video',
        component: () => import(/* webpackChunkName: "base" */ '@/views/video')
      },
      {
        path: '/qa',
        component: () => import('@/views/QA')
      },
      {
        path: '/my',
        component: () => import('@/views/My')
      }
    ]
  },
  {
    path: '/login',
    //路由懒加载,用到 才会加载词路由
    component: () => import('@/views/login')
  },
  {
    path: '/seatch',
    component: () => import('@/views/seatch')
  },
  {
    path: '/uase',
    component: () => import('@/views/uase/uaseinfo')
  },
  {
    path: '/detail/:name',
    name: 'detail',
    component: () => import('@/views/home/Info/detailed')
  },
  {
    path: '/abbb',
    name: 'detail',
    component: () => import('@/views/home/Info/ceshi')
  }
]

const router = new VueRouter({
  routes
})

export default router
